<!-- 开票 -->
<template>
  <view>
    <view class="list-view">
      <view class="cell-item flex">
        <view class="flex content">
          <view class="name"> 公司全称 </view>
          <view class="input">
            <u--input
              border="none"
              v-model="processorInvoiceInfo.code"
            ></u--input>
          </view>
        </view>
        <!-- <view class="flex">
          <u-icon name="photo-fill" color="#409EFF" size="24"></u-icon>
        </view> -->
      </view>
      <view class="cell-item flex">
        <view class="flex content">
          <view class="name"> 税号 </view>
          <view class="input">
            <u--input
              border="none"
              v-model="processorInvoiceInfo.tax_number"
            ></u--input>
          </view>
        </view>
        <view class="flex">
          <text style="color: #999">税率</text>
        </view>
      </view>
    </view>
    <view class="m-t-40">
      <view class="cell-item flex">
        <view class="flex content">
          <view class="name"> 地址 </view>
          <view class="input">
            <u--input
              border="none"
              v-model="processorInvoiceInfo.address_full"
            ></u--input>
          </view>
        </view>
      </view>
      <view class="cell-item flex">
        <view class="flex content">
          <view class="name"> 电话 </view>
          <view class="input">
            <u--input
              border="none"
              v-model="processorInvoiceInfo.tel"
            ></u--input>
          </view>
        </view>
      </view>
      <!-- <view class="cell-item flex">
        <view class="flex content">
          <view class="name"> 营业执照 </view>
          <view class="input">
            <u--image
              class="image"
              :showLoading="true"
              width="80px"
              height="80px"
              @click="click"
            ></u--image>
          </view>
        </view>
      </view> -->
      <view class="cell-item flex">
        <view class="flex content btn-view">
          <view class="btn flex" @click="onAddBank">
            <u-icon name="plus" size="10"></u-icon>
            <text class="p-l-20">添加银行卡</text>
          </view>
          <view class="btn flex">
            <u-icon name="camera-fill" size="10"></u-icon>
            <text class="p-l-20">识别营业执照</text>
          </view>
        </view>
      </view>
    </view>
    <!-- <view class="fixed-btn">
      <u-button
        text="保存"
        type="primary"
        shape="circle"
        color="linear-gradient(to right, rgb(64, 158, 255), rgb(64, 158, 255), rgb(96, 180, 246), rgb(96, 180, 246))"
        @click="onSave"
      ></u-button>
    </view> -->

    <!-- 添加银行卡 -->
    <u-popup
      :show="show"
      :round="10"
      :closeOnClickOverlay="false"
      mode="center"
    >
      <view class="popup-view">
        <view class="title"> 新增账户 </view>
        <view class="form-view m-b-40">
          <view
            class="form-item"
            @click="
              btnSelectGoods(
                '/pages/application/pages/finance/account/bank-list/bank-list'
              )
            "
          >
            <view class="label"> 开户行 </view>
            <view class="value flex">
              <u--input
                border="surround"
                disabled
                v-model="processorInvoiceInfo.bankIdName"
              ></u--input>
            </view>
          </view>
          <view class="form-item">
            <view class="label"> 卡号 </view>
            <view class="value flex">
              <u--input
                border="surround"
                v-model="processorInvoiceInfo.accountNumber"
              ></u--input>
            </view>
          </view>
          <view class="form-item">
            <view class="label"> 开户人 </view>
            <view class="value flex">
              <u--input
                border="surround"
                v-model="processorInvoiceInfo.holder"
              ></u--input>
            </view>
          </view>
          <view class="form-item">
            <view class="label"> 发票类型 </view>
            <view class="value flex">
              <u--input
                border="surround"
                v-model="processorInvoiceInfo.invoiceId"
              ></u--input>
            </view>
          </view>
        </view>
        <view class="bot-view flex flex-sa">
          <view class="btn" @click="onCencal"> 取消 </view>
          <view class="btn" @click="onSave"> 保存 </view>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<script>
import { getVoDataById } from "@/apis/inventory/converter";
export default {
  name: "Others",
  data() {
    return {
      value: "",
      show: false,
      processorInvoiceInfo: {
        full_name: "", // 发票抬头
        tax_number: "",
        address_full: "",
        tel: "",
        bankId: "",
        bankIdName: "", //开户行
        holder: "",
        taxRate: "", // 税率
        accountNumber: "",
        code: "",
        invoiceId: "",
      },
    };
  },
  created() {
    uni.$on("selectedBank", (data) => {
      this.processorInvoiceInfo.bankIdName = data.label;
      this.processorInvoiceInfo.bankId = data.value;
    });
  },
  beforeDestroy() {
    uni.$off("selectedBank");
  },
  methods: {
    getDataItem(id) {
      getVoDataById(id).then((res) => {
        if (!res.flag) return;
        const data = res.data || {};
        this.processorInvoiceInfo = data.processorInvoiceInfo;
      });
    },
    btnSelectGoods(url) {
      if (!url) return;
      this.$Router.push({
        path: url,
      });
    },
    onSave() {
      uni.showToast({
        title: "加工商不能为空",
        icon: "none",
      });
    },
    // 跳转选择参数
    toParameter() {
      this.$Router.push({
        name: "inventoryQuantityConverterParameter",
      });
    },
    // 打开弹框
    onAddBank() {
      this.show = true;
    },
    // 取消
    onCencal() {
      this.show = false;
      // 参数重置
    },
    // 保存
    onSave() {
      this.onCencal();
    },
  },
  mounted() {},
};
</script>

<style lang='scss' scoped>
.cell-item {
  background-color: #fafafa;
  border-bottom: 1rpx solid #ddd;
  min-height: 100rpx;
  align-items: center;
  padding-right: 30rpx;
  .content {
    flex: 1;
    align-items: center;
    .name {
      width: 140rpx;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #999;
      text-align: right;
    }
    .input {
      flex: 1;
      padding: 0 30rpx;
      .image {
        margin: 50rpx;
      }
    }
  }
  .btn-view {
    justify-content: space-around;
    padding-left: 30rpx;
    margin: 30rpx 0;
    .btn {
      border: 1rpx dashed #999;
      padding: 14rpx 40rpx;
      border-radius: 8rpx;
    }
  }
}
.label {
  width: 100rpx;
  color: #999;
}
.fixed-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20rpx 30rpx 20rpx;
  background: #fafafa;
}
</style>



